<%

sBusUnit		= Request.Form("cboBusUnit")
nBusUnitIndex	= Request.Form("nBusUnitIndex")
sReportType		= Request.Form("cboReport")
nReportTypeIndex= Request.Form("nReportTypeIndex")
sDateFrom		= Request.Form("dtDateFrom")
sDateTo			= Request.Form("dtDateTo")
sSummary		= Request.Form("sSummary")

'------------------------------------------- some validation --------------------------------------------------------------
if sDateFrom > sDateTo then
	sErrorMessage = "The ""date from"" cannot be after the ""date to"""
end if

if sDateFrom = "" then
	sErrorMessage = "Please enter the ""date from"" value"
end if

if sDateTo = "" then
	sErrorMessage = "Please enter the ""date to"" value"
end if

'if sBusUnit = "" then
'	sErrorMessage = "Please select the business unit"
'end if

if len(sDateFrom) < 8 then
	sErrorMessage = "Please specify a valid date"
end if

if len(sDateTo) < 8 then
	sErrorMessage = "Please specify a valid date"
end if


'--------------------------------------------------------------------------------------------------------------------------




'------------------------------------------- retrieve the recordset of data -----------------------------------------------

if sErrorMessage = "" then
	dim dllCreateReport
	dim rsCreateReport

	set dllCreateReport = Server.CreateObject("KeyTax.clsReports")
		
	if sReportType = "REQ" then
		set	rsCreateReport = dllCreateReport.Requests(sBusUnit, sDateFrom, sDateTo)
	elseif sReportType = "USERS" then
		set	rsCreateReport = dllCreateReport.NewUsers(sBusUnit, sDateFrom, sDateTo)
	elseif sReportType = "REP" then
		'Response.Write "sReportType = " &sReportType
		'Response.Write "<br>sBusUnit" & sBusUnit
		'Response.Write "<br>sDateFrom" & sDateFrom
		'Response.Write "<br>sDateTo" & sDateTo
		'Response.End
		set rsCreateReport = dllCreateReport.finalisedCancelledReqReport(sBusUnit,sDateFrom,sDateTo)
	elseif sReportType = "DEC" then
		set rsCreateReport = dllCreateReport.DeclinedRequestsReport(sBusUnit, sDateFrom,sDateTo)
	end if
	if rsCreateReport.EOF then
		sErrorMessage = "There were no details to retrieve for the criteria you have specified."
	else
		sShowResults = "Y"
	end if
	
	set dllCreateReport = nothing
end if
'--------------------------------------------------------------------------------------------------------------------------

%>